<template>
    <el-popover
        ref='popover'
        class="popconfirm"
        placement="left"
        title="请选择审核结果，审核拒绝请填写拒绝原因"
        width="320"
        trigger="click">
        <el-form>
            <el-form-item>
                <el-input placeholder="请填写拒绝原因" v-model="reason"></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type='danger' @click='reject'>拒绝</el-button>
                <el-button type='success' @click='pass'>通过</el-button>
            </el-form-item>
        </el-form>
        <el-button slot="reference" type='text'>人工审核</el-button>
    </el-popover>
</template>

<script>
    import {closePopover, toast} from '@u';
    export default {
        props : {
            //表格行数据
            tableRow : {
                type : Object,
                default :_ => {},
                require : true
            },
            //审核拒绝是否需要填写原因
            requireReason : {
                type : Boolean,
                default : true
            }
        },
        data () {
            return {
                reason : null
            }
        },
        methods : {
            reject  () {
                if (this.requireReason && !this.reason) {
                    toast('请填写拒绝原因', 'error');
                    return;
                }

                closePopover(this.$refs.popover);
            },
            pass () {

                closePopover(this.$refs.popover);
            },
        }
    }
</script>

<style lang='less' scoped>

</style>